﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Testharness
{
    public partial class CodeSnippetsForm : Form
    {
        public CodeSnippetsForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var sw = new Stopwatch();
            int start = 0;
            int loops = 1000000;

            sw.Start();

            Parallel.For(start, loops, index =>
            {
                //Debug.WriteLine(string.Format("Index: {0} | Counter: {1}", start, index));
            });

            sw.Stop();

            Debug.WriteLine(sw.Elapsed.TotalSeconds);

            sw.Start();

            for(int i = 0; i < loops; i++)
            {
                //Debug.WriteLine(string.Format("Index: {0} | Counter: {1}", start, i));
            }

            sw.Stop();

            Debug.WriteLine(sw.Elapsed.TotalSeconds);
        }
    }
}
